package vistas;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JTextField;
import javax.swing.ListModel;

import javax.swing.WindowConstants;
import javax.swing.SwingUtilities;




/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class AgregarItemsPedido extends javax.swing.JFrame 
{
	
	private JLabel jLabel2;
	private JLabel jLabel3;
	private JButton jButton1;
	private JList jList1;
	private JButton jButton2;
	private JButton cancelar;
	private JButton ok;
	private JTextField cantidad;
	private JTextField articulo;

	private static final long serialVersionUID = 1L;

	/**
	* Auto-generated main method to display this JFrame
	*/
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				AgregarItemsPedido inst = new AgregarItemsPedido();
				inst.setLocationRelativeTo(null);
				inst.setVisible(true);
				
			}
		});
	}
	
	public AgregarItemsPedido() {
		super();
		initGUI();
	}
	public AgregarItemsPedido(MenuPrincipal mnu) {
		super();
		initGUI();
		mnu.dispose();
	}
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			getContentPane().setLayout(null);
			this.setTitle("Alta Cliente");

			{
				jLabel2 = new JLabel();
				getContentPane().add(jLabel2);
				jLabel2.setText("Articulo que desea agregar");
				jLabel2.setBounds(16, 23, 163, 14);
			}
			{
				jLabel3 = new JLabel();
				getContentPane().add(jLabel3);
				jLabel3.setText("Cantidad");
				jLabel3.setBounds(16, 49, 129, 14);
			}
			{
				articulo = new JTextField();
				getContentPane().add(articulo);
				articulo.setBounds(187, 20, 81, 21);
			}
			{
				cantidad = new JTextField();
				getContentPane().add(cantidad);
				cantidad.setBounds(187, 46, 81, 21);
			}
			{
				ok = new JButton();
				getContentPane().add(ok);
				ok.setText("Aceptar");
				ok.setBounds(120, 223, 105, 21);
				ok.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) 
					{
						/*Sistema.getInstancia().altaCliente(nombre.getText(), articulo.getText(), cantidad.getText(), dni.getText());
					
						limpiarPantalla();*/
					}
				});
			}
			{
				cancelar = new JButton();
				getContentPane().add(cancelar);
				cancelar.setText("Cancelar");
				cancelar.setBounds(243, 223, 114, 21);
				cancelar.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt)
					{
						limpiarPantalla();
					}
				});
			}
			{
				jButton1 = new JButton();
				getContentPane().add(jButton1);
				jButton1.setText("Verificar Stock");
				jButton1.setBounds(192, 86, 89, 23);
				jButton1.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {
						System.out.println("jButton1.actionPerformed, event="+evt);
						//TODO add your code for jButton1.actionPerformed
					}
				});
			}
			{
				jButton2 = new JButton();
				getContentPane().add(jButton2);
				jButton2.setText("Agregar a Pedido");
				jButton2.setBounds(298, 86, 105, 23);
				jButton2.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {
						System.out.println("jButton2.actionPerformed, event="+evt);
						//TODO add your code for jButton2.actionPerformed
					}
				});
			}
			{
				ListModel jList1Model = 
					new DefaultComboBoxModel(
							new String[] { "Item One", "Item Two" });
				jList1 = new JList();
				getContentPane().add(jList1);
				jList1.setModel(jList1Model);
				jList1.setBounds(68, 120, 335, 97);
			}
			pack();
			this.setSize(527, 300);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
		private void limpiarPantalla()
		{
			
			articulo.setText("");
			cantidad.setText("");
					}
		
		/**
		* Auto-generated method for setting the popup menu for a component
		*/
		@SuppressWarnings("unused")
		private void setComponentPopupMenu(final java.awt.Component parent, final javax.swing.JPopupMenu menu) {
			parent.addMouseListener(new java.awt.event.MouseAdapter() {
				public void mousePressed(java.awt.event.MouseEvent e) {
					if(e.isPopupTrigger())
						menu.show(parent, e.getX(), e.getY());
				}
				public void mouseReleased(java.awt.event.MouseEvent e) {
					if(e.isPopupTrigger())
						menu.show(parent, e.getX(), e.getY());
				}
			});
		}

}
